<?php
function duration($secs) 
    { 
        $vals = array('w' => (int) ($secs / 86400 / 7), 
                      'd' => $secs / 86400 % 7, 
                      'h' => $secs / 3600 % 24, 
                      'm' => $secs / 60 % 60, 
                      's' => $secs % 60); 
 
        $ret = array(); 
 
        $added = false; 
        foreach ($vals as $k => $v) { 
            if ($v > 0 || $added) { 
                $added = true; 
                $ret[] = $v . $k; 
            } 
        } 
 
        return join(' ', $ret); 
    } 
?>
<style>
.titlepanel img {
	margin-right:5px;
}
</style>
<div class="opaque panel" style="float:left">
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('last-login-16.png');
 echo __('Last login',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// Show Last login
for ($index=0;$index<10;$index++)
{
	echo "<div>";
	echo $index+1;
	if (!empty($lastlogins[$index]))
		echo ' - '.$lastlogins[$index]['stat']['player'];
	echo "</div>";
}
?>
</div>
</div>
</div>
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('time_played.jpg');echo __('Time played',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// Show total time played
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($totaltime[$index]))
		echo ' - '.$totaltime[$index]['stat']['player'].' - '.duration($totaltime[$index]['stat']['value']);
	echo "<br/>";
}
?>
</div>
</div>
</div>
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('demolition.jpg');echo __('Top 10 demolition men',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// show top 10 block destroyers
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($totalblockdestroy[$index]))
		echo ' - '.$totalblockdestroy[$index]['stat']['player'].' - '.$totalblockdestroy[$index]['stat']['value'].__(' blocks',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('builder.png');echo __('Top 10 builders',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// show top 10 block builder
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($totalblockcreate[$index]))
		echo ' - '.$totalblockcreate[$index]['stat']['player'].' - '.$totalblockcreate[$index]['stat']['value'].__(' blocks',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('gabbler.gif');echo __('Top 10 gabblers',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// show top 10 chatters
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($chat[$index]))
		echo ' - '.$chat[$index]['stat']['player'].' - '.$chat[$index]['stat']['value'];
	echo "<br/>";
}
?>
</div>
</div>
</div>

<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('traveler.gif');echo __('Top 10 travelers',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// show top 10 most travelers
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($move[$index]))
		echo ' - '.$move[$index]['stat']['player'].' - '.$move[$index]['stat']['value'].__(' blocks',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>

<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('killer.gif');echo __('Top 10 killers',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
// show top 10 most travelers
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($kills[$index]))
		echo ' - '.$kills[$index]['stat']['player'].' - '.$kills[$index]['stat']['value'].__(' killed',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>

<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('death.gif');echo __('Top 10 graves lovers',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($deaths[$index]))
		echo ' - '.$deaths[$index]['stat']['player'].' - '.$deaths[$index]['stat']['value'].__(' dead',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>
<div class="statspanel">
<div class="titlepanel"><?php echo $html->image('muscle.png');echo __('Top 10 tough guys',true); ?></div>
<div class="ui-widget-content contentpanel" id="status_bar">
<div style="margin-left:5px">
<?php
for ($index=0;$index<10;$index++)
{
	echo $index+1;
	if (!empty($damagetaken[$index]))
		echo ' - '.$damagetaken[$index]['stat']['player'].' - '.$damagetaken[$index]['stat']['value'].__(' damages',true);
	echo "<br/>";
}
?>
</div>
</div>
</div>
</div>